package com.jic.interaction.payOrder.controller;

import com.alibaba.fastjson.JSONObject;
import com.jic.common.base.vo.RestResult;
import com.jic.interaction.payOrder.service.PayOrderService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;

/**
 * 支付
 */
@RestController
@RequestMapping("/feign/pay")
@Api(tags = " [支付接口]")
@Slf4j
//TODO
public class PayOrderController{

    @Resource
    private PayOrderService payOrderService;

    /**
     * 预下单
     * @param jsonObject
     * @return
     */
    @PostMapping("/prePayOrder")
    public RestResult<JSONObject> prePayOrder(@RequestBody JSONObject jsonObject){
        JSONObject result = payOrderService.prePayOrder(jsonObject);
        return RestResult.success(result);
    }

    /**
     * 预下单查询
     * @param jsonObject
     * @return
     */
    @PostMapping("/prePayOrderCheck")
    public RestResult<JSONObject> prePayOrderCheck(@RequestBody JSONObject jsonObject){
        return null;
    }

    /**
     * 卡密因子
     * @param jsonObject
     * @return
     */
    @PostMapping("/getPwdFactor")
    public RestResult<JSONObject> getPwdFactor(@RequestBody JSONObject jsonObject){
        JSONObject result = payOrderService.getPassWord(jsonObject);
        return RestResult.success(result);
    }

    /**
     * 微众支付
     * @paramprePayOrderCheck
     * @return
     */
    @PostMapping("/wzPay")
    public RestResult<JSONObject> wzPay(@RequestBody JSONObject jsonObject){
        JSONObject result = payOrderService.wzPay(jsonObject);
        return RestResult.success(result);
    }
    /**
     * 微众支付回查
     * @param
     * @return
     */
    @PostMapping("/wzPayCheck")
    public RestResult<JSONObject> wzPayCheck(@RequestBody JSONObject jsonObject){
        JSONObject result = payOrderService.wzPayCheck(jsonObject);
        return RestResult.success(result);
    }
    /**
     * 微众退款
     * @param
     * @return
     */
    @PostMapping("/refundOrder")
    public RestResult<JSONObject> refundOrder(@RequestBody JSONObject jsonObject){
        JSONObject result = payOrderService.refundOrder(jsonObject);
        return RestResult.success(result);
    }

    /**
     * 微众退款查询
     * @param
     * @return
     */
    @PostMapping("/refundOrderCheck")
    public RestResult<JSONObject> refundOrderCheck(@RequestBody JSONObject jsonObject){
        JSONObject result = payOrderService.refundOrderCheck(jsonObject);
        return RestResult.success(result);
    }
    /**
     * 微信支付
     * @param
     * @return
     */
    @PostMapping("/wxPay")
    public RestResult<JSONObject> wxPay(@RequestBody JSONObject jsonObject){
        return null;
    }
}
